/////////////////////////////////////////////////////////////////////////
// $Id: jit.h 10613 2012-06-24 16:44:02Z xint $
/////////////////////////////////////////////////////////////////////////
//
//   Copyright (c) 2007-2011 Stanislav Shwartsman
//          Written by Stanislav Shwartsman [sshwarts at sourceforge net]
//
//  This library is free software; you can redistribute it and/or
//  modify it under the terms of the GNU Lesser General Public
//  License as published by the Free Software Foundation; either
//  version 2 of the License, or (at your option) any later version.
//
//  This library is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//  Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public
//  License along with this library; if not, write to the Free Software
//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA B 02110-1301 USA
//
/////////////////////////////////////////////////////////////////////////

#ifndef BX_JIT_H
#define BX_JIT_H

/// @ BX_JIT_C - this is a structure containing all the interfaces JIT exports to
//  @ the interpreter. This structure is initialized by the JIT compiler.
typedef struct BX_JIT_C
{
 // code for entering the code cache.
 void *comp_code_cache_entry;
 // code for exiting the code cache.
 void *comp_code_cache_exit;
 // code for gettting the address of current exitting linkstub.
 void *comp_code_linkstub_exit;
 // code which does nothing. simply return.
 void *comp_code_dummy;
} BX_JIT_C;


#define BX_COMP_INIT_FUNC     "initializeEmulatorJIT"
#define BX_COMP_COMP_FUNC     "compile"
#define BX_COMP_JITC_FUNC     "initializeEmulatorSnippet"
#define BX_COMP_INTC_FUNC     "initializeInterpreterCallbacks"
#define BX_COMP_INVL_FUNC     "invalidateCompilation"
typedef struct
{
  void*            init_func;      // jit initialization func.
  void*            comp_func;      // jit compilation func.
  void*            jitc_func;      // jit communication.
  void*            intc_func;      // interpreter call back functions.
  void*            invl_func;      // interpreter call back functions.
} jit_callbacks;

typedef struct
{
  void*            find_field_offset_by_name; // find the offset of CPU field.
  void*            find_reg_offset_by_index;  // find the offset of CPU field.
  void*            interpret;                // bochs callout.
  void*            naked_interpret;          // naked bochs callout.
  void*            resolve_modrm;           // naked bochs callout.
  void*            modrm_xlation;           // naked bochs callout.
} inp_callbacks;



#endif
